
<%@ page import="org.product.Product" %>
<%@ page import="org.knowlege.KnowlegeType" %>
<!doctype html>
<html>
	<head>
		<meta name="layout" content="main">
		<g:set var="entityName" value="${message(code: 'product.label', default: 'Product')}" />
		<title><g:message code="default.show.label" args="[entityName]" /></title>
		
	</head>
	<body>
		<script type="text/javascript">
			$(document).ready(function(){
				$(".module").groupContent();
			});
		</script>
		
		<a href="#show-product" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
		<div class="nav" role="navigation">
			<ul>
				<li><g:link class="list" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></li>
				<li><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></li>
				<li><g:link class="edit" controller="knowlege" action="list"  id="${productInstance?.id}" params="[productId:productInstance.id]">edit knowlege</g:link></li>
			</ul>
		</div>
		<div id="show-product" class="content scaffold-show" role="main">
			<h1><g:message code="default.show.label" args="[entityName]" /></h1>
			<g:if test="${flash.message}">
			<div class="message" role="status">${flash.message}</div>
			</g:if>
			<ol class="property-list product">
			
				<g:if test="${productInstance?.productCode}">
				<li class="fieldcontain">
					<span id="productCode-label" class="property-label"><g:message code="product.productCode.label" default="Product Code" /></span>
					
						<span class="property-value" aria-labelledby="productCode-label"><g:fieldValue bean="${productInstance}" field="productCode"/></span>
					
				</li>
				</g:if>
			
				<g:if test="${productInstance?.productName}">
				<li class="fieldcontain">
					<span id="productName-label" class="property-label"><g:message code="product.productName.label" default="Product Name" /></span>
					
						<span class="property-value" aria-labelledby="productName-label"><g:fieldValue bean="${productInstance}" field="productName"/></span>
					
				</li>
				</g:if>
			
				<g:if test="${productInstance?.productSpec}">
				<li class="fieldcontain">
					<span id="productSpec-label" class="property-label"><g:message code="product.productSpec.label" default="Product Spec" /></span>
					
						<span class="property-value" aria-labelledby="productSpec-label"><g:fieldValue bean="${productInstance}" field="productSpec"/></span>
					
				</li>
				</g:if>
				<g:if test="${productInstance?.unit}">
				<li class="fieldcontain">
					<span id="unit-label" class="property-label"><g:message code="product.unit.label" default="unit" /></span>
					<span class="property-value" aria-labelledby="unit-label"><g:fieldValue bean="${productInstance}" field="unit"/></span>
					
				</li>
				</g:if>
				<g:if test="${productInstance?.productPackage}">
				<li class="fieldcontain">
					<span id="productPackage-label" class="property-label"><g:message code="product.productPackage.label" default="productPackage" /></span>
					<span class="property-value" aria-labelledby="productPackage-label"><g:fieldValue bean="${productInstance}" field="productPackage"/></span>
					
				</li>
				</g:if>
			
				<g:if test="${productInstance?.productDes}">
				<li class="fieldcontain">
					<span id="productDes-label" class="property-label"><g:message code="product.productDes.label" default="Product Des" /></span>
					<span class="property-value" aria-labelledby="productDes-label"><g:fieldValue bean="${productInstance}" field="productDes"/></span>
					
				</li>
				</g:if>
			
				<g:if test="${productInstance?.productType}">
				<li class="fieldcontain">
					<span id="productTypes-label" class="property-label"><g:message code="product.productType.label" default="Product Types" /></span>
					
						<g:each in="${productInstance.productType}" var="p">
						<span class="property-value" aria-labelledby="productType-label"><g:link controller="productType" action="show" id="${p.id}">${p?.encodeAsHTML()}</g:link></span>
						</g:each>
					
				</li>
				</g:if>
			
			</ol>
			<g:form>
				<fieldset class="buttons">
					<g:hiddenField name="id" value="${productInstance?.id}" />
					<g:link class="edit" action="edit" id="${productInstance?.id}"><g:message code="default.button.edit.label" default="Edit" /></g:link>
					<g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" />
				</fieldset>
			</g:form>
		</div>
		<div id="details"  class="content scaffold-show" role="main">
			<h1><g:message code="knowlege.label" /></h1>
			
			<div id="knowlege-details" style="width:100%;">
				<ul class="tab">
					<g:each in="${KnowlegeType.list()}" status="i" var="knowlegeTypeInstance">
						<li>
							<g:remoteLink controller="knowlege" action="listByType" params="[productId:productInstance.id,knowlegeTypeId:knowlegeTypeInstance.id]" update="[success:'show-knowleges',failure:'error']"
    							on404="alert('not found');" onLoading="showSpinner(true);" onSuccess="showSpinner(false);" elementId="type${i}">${knowlegeTypeInstance}</g:remoteLink>
						</li>
					</g:each>
				</ul>
			</div>
		</div>
		<div id="show-knowleges" style="display:block;" class="box"></div>
		<div id="error"></div>
		<script type="javascript/text">
			$(document).ready(function(){
				$("#type0").click();
			});
		</script>
	</body>
</html>
